







![]() ![]() |
CuttingEdge.Conditions reference library |
ValidatorExtensions..::.Evaluate<(Of <(T>)>) Method (ConditionValidator<(Of <(T>)>), Boolean, String) |
ValidatorExtensions Class See Also Send Feedback |
Checks whether the specified condition equals true.
An exception is thrown otherwise.
Namespace:
CuttingEdge.Conditions
Assembly:
CuttingEdge.Conditions (in CuttingEdge.Conditions.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function Evaluate(Of T) ( _ validator As ConditionValidator(Of T), _ condition As Boolean, _ conditionDescription As String _ ) As ConditionValidator(Of T) |
C# |
---|
public static ConditionValidator<T> Evaluate<T>( ConditionValidator<T> validator, bool condition, string conditionDescription ) |
Visual C++ |
---|
public: generic<typename T> static ConditionValidator<T>^ Evaluate( ConditionValidator<T>^ validator, bool condition, String^ conditionDescription ) |
JavaScript |
---|
JavaScript does not support generic types or methods. |
Parameters
- validator
- Type: CuttingEdge.Conditions..::.ConditionValidator<(Of <(T>)>)
The ConditionValidator<(Of <(T>)>) that holds the value that has to be checked.
- condition
- Type: System..::.Boolean
true to prevent an Exception from being thrown; otherwise, false.
- conditionDescription
- Type: System..::.String
Describes the condition that should hold. i.e.: 'value should be valid'. When the description contains a {0} marker, that marker will be replaced with the actual name of the parameter. The description will be used in the message of the thrown exception.
Type Parameters
- T
- The type of the Value of the specified validator.
Return Value
The specified validator instance.
Exceptions
Exception | Condition |
---|---|
System..::.ArgumentException | Thrown when the condition equals false, while the specified validator is created using the Requires extension method. |
System..::.ArgumentNullException | Thrown when the condition equals false and the Value of the specified validator is a null reference, while the specified validator is created using the Requires extension method. |
System.ComponentModel..::.InvalidEnumArgumentException | Thrown when the condition equals false and the Value of the specified validator is an Enum type, while the specified validator is created using the Requires extension method. |
CuttingEdge.Conditions..::.PostconditionException | Thrown when the condition equals false, while the specified validator is created using the Ensures extension method. |